/**
 * 
 */
package com.jszw.bcp.test;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zhengzw
 *
 */
public class Delegate implements InvocationHandler {

	private Factory factory;

	public Factory getFactory() {
		return factory;
	}

	public void setFactory(Factory factory) {
		this.factory = factory;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		return method.invoke(this.getFactory().getObject(), args);
	}
}
